<?php


/* $Id: template.php 128 2007-03-04 23:40:48Z qry $ */


function _phptemplate_variables($hook, $vars = array()) {
  global $show_main_map;

  $body_classes   = array();
  $body_classes[] = "loading";

  $vars['body_classes']  = implode(' ', $body_classes);
  $vars['show_main_map'] = isset($show_main_map) && $show_main_map ? TRUE : FALSE;

  return $vars;
} /* _phptemplate_variables() */


function fmapb_hdr_nav_bar() {
  global $user;

  $out = "<ul class=\"hdr-nav-list\">\n";

  /*
   * Show all the common links.
   */
  $out = $out . _fmapb_hdr_nav_bar_common();

  if (!$user->uid)
  {
    /*
     * Show anonymous user specific links.
     */
    $out = $out . _fmapb_hdr_nav_bar_anon();
  }
  else
  {
    /*
     * Show authenticated user specific links.
     */
    $out = $out . _fmapb_hdr_nav_bar_auser($user);
  }

  $out = $out . '</ul>';

  return $out;
} /* fmapb_hdr_nav_bar() */


/*
 * Return list elements of all the common links.
 */
function _fmapb_hdr_nav_bar_common() {
  $links = array(
    array(
      'title' => t('Home'),
      'href'  => ''),
    array(
      'title' => t('News'),
      'href'  => 'node'),
    array(
      'title' => t('Help'),
      'href'  => 'node/5'),
    array(
      'title' => t('Forums'),
      'href'  => 'forum'));

  return _fmapb_links2list($links);
} /* _fmapb_hdr_nav_bar_common() */


/*
 * Return list elements of anonymous specific links.
 */
function _fmapb_hdr_nav_bar_anon() {
  $links = array(
    array(
      'title' => t('Register'),
      'href'  => 'user/register'),
    array(
      'title' => t('Login'),
      'href'  => 'user'));

  return _fmapb_links2list($links);
} /* _fmapb_hdr_nav_bar_anon() */


/*
 * Return list elements of authenticated user specific links.
 */
function _fmapb_hdr_nav_bar_auser($user) {
  $links = array(
    array(
      'title' => t('Add New'),
      'href'  => 'node/add/mplace'),
    array(
      'title' => t('My Account'),
      'href'  => 'user/' . $user->uid . '/edit'),
    array(
      'title' => t('Logout'),
      'href'  => 'logout'));

  return _fmapb_links2list($links);
} /* _fmapb_hdr_nav_bar_auser() */


function _fmapb_links2list($links) {
  $out = '';
  foreach ($links as $link)
  {
    $out = $out . '<li>' . l($link['title'], $link['href']) . "</li>\n";
  }

  return $out;
} /* _fmapb_links2list() */


function phptemplate_search_theme_form($form) {
  /**
   * This snippet catches the default searchbox and looks for
   * search-theme-form.tpl.php file in the same folder
   * which has the new layout.
   */
  return _phptemplate_callback('search-theme-form', array('form' => $form));
} /* phptemplate_search_theme_form() */


/*
Array
(
    [menu-1-1-1] => Array
        (
            [title] => Create content
            [href] => node/add
            [attributes] => Array
                (
                )

        )

    [menu-1-2-1] => Array
        (
            [title] => Forums
            [href] => forum
            [attributes] => Array
                (
                )

        )

    [menu-1-3-1] => Array
        (
            [title] => Administer
            [href] => admin
            [attributes] => Array
                (
                )

        )

    [menu-1-4-1] => Array
        (
            [title] => Log out
            [href] => logout
            [attributes] => Array
                (
                )

        )
)
*/

?>
